﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Media3D;

namespace CrazyClient
{
    /// <summary>
    /// Interaction logic for SetData.xaml
    /// </summary>
    public partial class SetData : ModelVisual3D
    {
        public SetData()
        {
            InitializeComponent();
          //  this.Loaded += new RoutedEventHandler(SetData_Loaded);
            
        }
        void SetData_Loaded(object sender, RoutedEventArgs e)
        {
            throw new NotImplementedException();
        }


        #region DataNameProperty
        public static readonly DependencyProperty DataNameProperty =
            DependencyProperty.Register("DataName", typeof(string),
            typeof(SetData),
            new PropertyMetadata(DataNameChanged));

        public string DataName
        {
            get
            {
                object result = GetValue(DataNameProperty);
                return (string)result;
            }
            set
            {
                SetValue(DataNameProperty, value);
            }
        }
        static private void DataNameChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {

        }
        #endregion
        #region ValueProperty
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(string),
            typeof(SetData),
            new PropertyMetadata(ValueChanged));

        public string Value
        {
            get
            {
                object result = GetValue(ValueProperty);
                return (string)result;
            }
            set
            {
                SetValue(ValueProperty, value);
            }
        }
        static private void ValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {

        }
        #endregion
        #region DataProperty
        public static readonly DependencyProperty DataProperty =
            DependencyProperty.Register("Data", typeof(CustomDictionary<string,object>),
            typeof(SetData),
            new PropertyMetadata(DataChanged));

        public CustomDictionary<string, object> Data
        {
            get
            {
                object result = GetValue(DataProperty);
                return (CustomDictionary<string, object>)result;
            }
            set
            {
                SetValue(DataProperty, value);
                if (!value.Keys.Contains(this.DataName))
                    value.Add(this.DataName, this.Value);
                value[this.DataName] = this.Value;
            }
        }
        static private void DataChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {

        }
        #endregion
    }
}
